package com.ihd.ihardwaretools.app;


import android.graphics.Color;
import android.graphics.Rect;
import android.widget.LinearLayout;

import com.ihd.ihardwaretools.R;
import com.ihd.ihardwaretools.common.CustomTopBar;

import org.jaaksi.pickerview.picker.BasePicker;
import org.jaaksi.pickerview.topbar.ITopBar;
import org.jaaksi.pickerview.util.Util;
import org.jaaksi.pickerview.widget.DefaultCenterDecoration;
import org.jaaksi.pickerview.widget.PickerView;

import cn.wowjoy.commonlibrary.app.BaseApplication;

public class MyApplication extends BaseApplication {

    @Override
    public void onCreate() {
        super.onCreate();
        initDefaultPicker();
    }

    private void initDefaultPicker() {
        PickerView.sDefaultVisibleItemCount = 5;
        // BasePickerView
        PickerView.sDefaultItemSize = 40;
        PickerView.sDefaultIsCirculation = false;

        // PickerView
        PickerView.sOutTextSize = 16;
        PickerView.sCenterTextSize = 18;
        PickerView.sCenterColor = getResources().getColor(R.color.C_46A5F9);
        PickerView.sOutColor = getResources().getColor(R.color.C_E8E9F0);

        // BasePicker
        int padding = Util.dip2px(this, 0);
        BasePicker.sDefaultPaddingRect = new Rect(padding, padding, padding, padding);
        BasePicker.sDefaultPickerBackgroundColor = Color.WHITE;
        // 自定义 TopBar
        BasePicker.sDefaultTopBarCreator = new BasePicker.IDefaultTopBarCreator() {
            @Override
            public ITopBar createDefaultTopBar(LinearLayout parent) {
                return new CustomTopBar(parent);
            }
        };

        DefaultCenterDecoration.sDefaultLineWidth = 1;
        DefaultCenterDecoration.sDefaultLineColor = getResources().getColor(R.color.C_DDDDDD);
        int leftMargin = Util.dip2px(this, 0);
        int topMargin = Util.dip2px(this, 0);
        DefaultCenterDecoration.sDefaultMarginRect = new Rect(leftMargin, -topMargin, leftMargin, -topMargin);
    }
}
